package io.renren.modules.sys.controller;

import io.renren.common.utils.ExcelUtils;
import io.renren.modules.sys.entity.vo.EMSVO;
import io.renren.modules.sys.entity.vo.SFVO;
import io.renren.modules.sys.entity.vo.YTVO;
import io.renren.modules.sys.service.OperationTotalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("sys/operationtotal")
public class OperationTotalController{
    @Autowired
    private OperationTotalService operationTotalService;

    @RequestMapping("/download")
    public void download(@RequestParam Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
        List<EMSVO> ems = operationTotalService.getEMS(params);
        String filename = "E特快标准模板"+System.currentTimeMillis()+".xlsx";
        ExcelUtils.exportExcel(ems, "订单信息", "汇总", EMSVO.class, filename, response);

    }
    @RequestMapping("/SFData")
    public void SFData(@RequestParam Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
        List<SFVO> sf = operationTotalService.getSF(params);
        String filename = "顺丰模板"+System.currentTimeMillis()+".xlsx";
        ExcelUtils.exportExcel(sf, "订单信息", "汇总", SFVO.class, filename, response);

    }
    @RequestMapping("/YTData")
    public void YTData(@RequestParam Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
        List<YTVO> yt = operationTotalService.getYT(params);
        String filename = "顺丰模板"+System.currentTimeMillis()+".xlsx";
        ExcelUtils.exportExcel(yt, "订单信息", "汇总", YTVO.class, filename, response);

    }



}


